<template>
  <div class="mine">
    <!-- 头部 -->
    <div class="header">
      <div class="bg"></div>
      <div class="user">
        <div class="user-logo">
          <img src="../../assets/img/mine/headimg.png" alt="" />
        </div>
        <div class="user-name">
          <p class="name" v-if="user">{{ user }}</p>
          <p class="name" v-else @click="login">去登录</p>
          <p class="time" v-if="user">你我相识已1.0天</p>
          <p class="time" v-else>你我还未相识</p>
        </div>
      </div>
      <div class="me">
        <ul>
          <li class="me-item">
            <p class="gz-num num">0</p>
            <p>我的关注</p>
          </li>
          <li class="me-item">
            <p class="dt-num num">0</p>
            <p>我的动态</p>
          </li>
          <li class="me-item">
            <p class="fs-num num">0</p>
            <p>我的粉丝</p>
          </li>
          <li class="me-item">
            <p class="jl-num num">0</p>
            <p>测试记录</p>
          </li>
        </ul>
      </div>
    </div>
    <!-- 版心 -->
    <div class="main">
      <div class="margin">
        <!--  -->
        <div class="options-top same">
          <ul class="option-list">
            <li
              class="option"
              v-for="(item, index) in options_top"
              :key="index"
            >
              <img class="icon" :src="item.url" />
              <span class="text">{{ item.title }}</span>
            </li>
          </ul>
        </div>
        <div class="options-middle same">
          <ul>
            <li
              class="option-item"
              v-for="(item, index) in options_middle"
              :key="index"
            >
              <p>
                <img :src="item.url" alt="" /> <span>{{ item.title }}</span>
              </p>
            </li>
          </ul>
        </div>
        <div class="options-bottom same">
          <ul>
            <li
              class="option-item"
              v-for="(item, index) in options_bottom"
              :key="index"
            >
              <p>
                <img :src="item.url" alt="" /> <span>{{ item.title }}</span>
              </p>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();
    let user = localStorage.getItem("tel");
    const options_middle = [
      {
        title: "帮助中心",
        url: require("../../assets/img/mine/帮助中心.png"),
      },
      {
        title: "隐私安全",
        url: require("../../assets/img/mine/隐私.png"),
      },
      {
        title: "设置",
        url: require("../../assets/img/mine/设置.png"),
      },
      {
        title: "壹点灵介绍",
        url: require("../../assets/img/mine/介绍.png"),
      },
      {
        title: "关于我们",
        url: require("../../assets/img/mine/我们.png"),
      },
    ];
    const options_bottom = [
      {
        title: "分享",
        url: require("../../assets/img/mine/分享.png"),
      },
      {
        title: "专家入驻",
        url: require("../../assets/img/mine/专家.png"),
      },
    ];
    const options_top = [
      {
        title: "账户余额",
        url: require("../../assets/img/mine/账户.png"),
      },
      {
        title: "红包卡券",
        url: require("../../assets/img/mine/红包.png"),
      },
      {
        title: "推广返利",
        url: require("../../assets/img/mine/返利.png"),
      },
      {
        title: "预约订单",
        url: require("../../assets/img/mine/预约.png"),
      },
      {
        title: "倾诉记录",
        url: require("../../assets/img/mine/倾诉.png"),
      },
      {
        title: "我的课程",
        url: require("../../assets/img/mine/课程.png"),
      },
    ];
    const login = () => {
      router.push("/login");
    };
    return {
      options_middle,
      options_bottom,
      options_top,
      user,
      login,
    };
  },
};
</script>
<style lang="less">
.flex() {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
html,
body {
  height: 100%;
  width: 100%;
}
.mine {
  font-family: PingFang SC;
  font-weight: bold;
  .header {
    width: 100%;
    height: 210px;
    background: #2798f4;
    position: relative;
    overflow: hidden;
    .bg {
      width: 263px;
      height: 263px;
      background: #32a7f6;
      opacity: 0.5;
      border-radius: 50%;
      position: absolute;
      right: -131px;
    }
    .user {
      height: 74px;
      margin-top: 12px;
      display: flex;
      .user-logo {
        width: 74px;
        height: 74px;
        margin-left: 13px;
        img {
          width: 74px;
          height: 74px;
        }
      }
      .user-name {
        margin-top: 17px;
        color: #ffffff;
        .name {
          margin-bottom: 6px;
          font-size: 18px;
          // letter-spacing: 1px;
          font-weight: 500;
          margin-left: 7px;
        }
        .time {
          font-size: 10px;
          font-weight: 500;
          margin-left: 12px;
        }
      }
    }
    .me {
      height: 35px;
      margin-top: 22px;
      ul {
        display: flex;
        .me-item {
          .flex();
          flex: 1;
          font-weight: bold;
          color: #ffffff;
          z-index: 99;
          .num {
            margin-bottom: 14px;
            font-size: 16px;
          }
        }
      }
    }
  }
  .main {
    margin-bottom: 100px;
    width: 100%;
    height: 585px;
    .margin {
      position: relative;
      width: 100%;
      height: 500px;
      .same {
        box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        background: #fff;
        position: absolute;
        left: 14px;
        width: 347px;
      }
      .options-top {
        height: 136px;
        top: -20px;
        .option-list {
          display: flex;
          flex-wrap: wrap;
          .option {
            .flex();
            margin-top: 17px;
            width: 86.7px;
            .icon {
              height: 22px;
              width: 22px;
              margin-bottom: 7px;
            }
            .text {
              font-size: 12px;
            }
          }
        }
      }
      .options-middle {
        height: 230px;
        top: 130px;
      }
      .options-middle,
      .options-bottom {
        ul {
          li {
            border-bottom: 1px solid #f3f3f3;
            height: 46px;
            p {
              margin-top: 11px;
              display: inline-block;
              img {
                margin-left: 8px;
                margin-right: 13px;
                width: 24px;
                height: 24px;
                vertical-align: middle;
              }
              span {
                color: #0e0e0e;
                vertical-align: middle;
              }
            }
          }
        }
      }
      .options-bottom {
        height: 93px;
        bottom: 30px;
      }
    }
  }
}
</style>
